CMake Qt Creator vendor presets

Specify Qt Creator preferences in the vendor section in CMakePresets.json and CMakeUserPresets.json.

CMake configuration presets

The following table summarizes the available presets.

PresetDescriptionRead More
AutorunCMakeRuns CMake to refresh project information when you edit a CMakeLists.txt configuration file in a project. Also, refreshes project information when you build the project.View CMake project contents
AskBeforePresetsReloadAsks before acting when you go to Build and select Reload CMake Presets.CMake presets
AskReConfigureInitialParamsAsks before acting when you select Re-configure with Initial Variables.Re-configuring with Initial Variables
PackageManagerAutoSetupSets up the Conan or vcpkg package manager for use with CMake.Using CMake with Package Managers
ShowAdvancedOptionsByDefaultShows all CMake variables by default in Initial Configuration and Current Configuration.Viewing Advanced Variables
ShowSourceSubfoldersHides subfolder names and arranges the files according to their source group in the Projects view.Hide subfolder names in Projects view
UseJunctionsForSourceAndBuildDirectoriesOn Windows, uses junction points for CMake configure, build, and install operations.Use junction points on Windows
runDeviceSpecifies the run device for the kit created from the preset. Overrides the automatic device selection based on CMAKE_SYSROOT. Can be a device type identifier (string) to use the default device of that type, or an object with type and additional settings. When using the object form, if no matching device exists, a new device is added to the device list. Valid device type identifiers are the strings returned by IDevice::type().addDev

An example of CMake configuration presets:

 "vendor": {
   "qt.io/QtCreator/1.0": {
     "AskBeforePresetsReload": false,
     "AskReConfigureInitialParams": false,
     "AutorunCMake": false,
     "PackageManagerAutoSetup": false,
     "ShowAdvancedOptionsByDefault": true,
     "ShowSourceSubFolders": false,
     "UseJunctionsForSourceAndBuildDirectories": true
   }
 }

To force a specific run device for a preset-based kit:

 "vendor": {
   "qt.io/QtCreator/1.0": {
     "runDevice": "GenericLinuxOsType"
   }
 }

Or to disambiguate among multiple devices of the same type:

 "vendor": {
   "qt.io/QtCreator/1.0": {
     "runDevice": {
       "type": "GenericLinuxOsType",
       "name": "my-raspberry-pi"
     }
   }
 }

The object form also supports specifying full device settings, which are used to create a device if no matching device exists:

 "vendor": {
   "qt.io/QtCreator/1.0": {
     "runDevice": {
       "type": "GenericLinuxOsType",
       "id": "MyRemoteDevice",
       "name": "my-raspberry-pi",
       "host": "192.168.1.100",
       "uname": "pi",
       "keyFile": "/home/user/.ssh/id_rsa",
       "sshPort": 22,
       "authentication": 1,
       "timeout": 5,
       "freePortsSpec": "8000-9000"
     }
   }
 }

Qt Creator looks for an existing device first by id, then by name. Only when neither matches does it add a new device, which then persists across sessions. Edit or remove it in Preferences > Devices > Devices, like any other device.

The following options are supported in the object form. They correspond to the SDK Tool addDev options of the same name, except where noted; for a complete reference, see addDev.

OptionDescription
typeDevice type identifier (required). Corresponds to --osType, not to --type.
idUnique ID for the device. If not set, Qt Creator generates one from the project and preset names.
nameDisplay name for the device. Falls back to a generated name if not set.
hostHost name or IP address of the device.
unameUsername to access the device.
keyFilePath to the user's private key file for SSH authentication.
sshPortPort number for SSH connections (default: 22).
authenticationAuthentication method: 0 for all methods, 1 for SSH key pair.
timeoutTimeout for reusing the SSH connection in seconds (default: 5).
machineTypeMachine type: 0 for hardware, 1 for an emulator (default: 0). Corresponds to --type.
freePortsSpecFree ports specification string (for example, "8000-9000"). Corresponds to --freePorts.

Build presets

The following table summarizes the available build presets.

PresetDescription
useStagingEnables staging for installation, which copies build artifacts to a separate staging directory before installation.
stagingDirPath to the staging directory used when useStaging is enabled.
iOSAutomaticProvisioningUpdatesAutomatically updates iOS provisioning profiles during the build.
clearSystemEnvironmentClears system environment variables before running the build step.

An example of Qt Creator build preset vendor presets:

 "vendor": {
   "qt.io/QtCreator/1.0": {
     "useStaging": true,
     "stagingDir": "${sourceDir}/staging",
     "iOSAutomaticProvisioningUpdates": true,
     "clearSystemEnvironment": false
   }
 }

Run presets

Run presets provide settings for running applications built with CMake.

Each run setting has a target that matches a build target name. Qt Creator creates one run configuration per run setting and applies the settings to it. Where a run setting does not set displayName, the run configuration is named after the target, with a numeric suffix from the second run setting for that target onwards (for example, myApp, myApp2, myApp3).

Settings that the run configuration does not support are ignored. For example, useDyldSuffix has no effect unless you run the application locally on macOS.

Run presets also support utility targets (add_custom_target in CMake). For these targets, Qt Creator creates a run configuration that runs cmake --build . --target <targetName>. To specify a custom executable instead, use the executable field.

The following table summarizes the available run settings:

PresetDescriptionRead More
targetThe name of the CMake build target. For executables, this matches the target created in CMakeLists.txt. For utility targets, this matches the name used in add_custom_target(). If the target does not exist as a CMake build target, Qt Creator creates a run configuration that runs the specified executable, or falls back to cmake --build . --target <targetName>.Building projects with CMake
displayNameDisplay name for the run configuration. If omitted, the target name is used. Use this to give meaningful names when a target has multiple run settings (for example, "myApp - tests", "myApp - debug").
executablePath to the executable to run. Supports CMake: Preset macros.Configure projects for running
argumentsCommand line arguments for the run configuration. Supports CMake: Preset macros.Configure projects for running
workingDirectoryWorking directory for the run configuration. Supports CMake: Preset macros.Configure projects for running
useTerminalWhether to run the application in a terminal window.Configure projects for running
useLibraryPathsAdds build library search paths to the runtime environment. On macOS this sets DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH, on Linux it sets LD_LIBRARY_PATH, and on Windows it adds to PATH.Configure projects for running
useDyldSuffix(macOS) Whether to load the debug version of linked frameworks by setting the DYLD_IMAGE_SUFFIX environment variable to _debug.Debug linked frameworks
useVncDisplay(Remote Linux) Whether to start a VNC server on the device and run the application on its display.View the application UI
enableCategoriesFilterEnables Qt logging category filtering by setting the QT_LOGGING_RULES and QT_MESSAGE_PATTERN environment variables.Set the environment for all run configurations
x11Forwarding(Remote Linux) The X11 display to forward to (for example, :0.0).Specify remote Linux run settings
runAsThe user account to run as (Unix only). Valid values are default, root, or a custom username.Run as a different user
environmentA JSON object mapping environment variable names to their values.Specify the environment for projects
activeIf set to true, the matched run configuration is set as the active (selected) run configuration for its build configuration. If multiple presets specify active, the last one processed wins.Configure projects for running

An example of Qt Creator run settings:

 "vendor": {
   "qt.io/QtCreator/1.0": {
     "runSettings": [
       {
         "target": "myApp",
         "displayName": "My App - production",
         "arguments": "--verbose --config production",
         "workingDirectory": "${sourceDir}/output",
         "useTerminal": false,
         "useLibraryPaths": true,
         "environment": {
           "MY_VAR": "my_value"
         }
       },
       {
         "target": "myApp",
         "displayName": "My App - debug",
         "arguments": "--debug",
         "workingDirectory": "${sourceDir}/debug-output",
         "useDyldSuffix": true,
         "useLibraryPaths": true,
         "active": true
       },
       {
         "target": "run-tests",
         "useTerminal": true
       },
       {
         "target": "shell",
         "displayName": "Interactive Shell",
         "executable": "/bin/bash",
         "arguments": "--help",
         "useTerminal": true
       }
     ]
   }
 }

This example creates four run configurations:

  • "My App - production" (from the first run setting)
  • "My App - debug" (from the second run setting, same target)
  • run-tests (a utility target, runs cmake --build . --target run-tests)
  • "Interactive Shell" (a standalone executable, runs /bin/bash)

Compiler presets

The following table summarizes the available presets.

For more information about compiler preferences, see Add compilers.

PresetDescription
cPath to the C compiler installation folder.
cxxPath to the C++ compiler installation folder.

An example of Qt Creator compiler presets:

 "vendor": {
   "qt.io/QtCreator/1.0": {
     "compiler": {
       "c" : "$env{HOME}/llvm/mac/bin/clang",
       "cxx" : "$env{HOME}/llvm/mac/bin/clang++"
     }
   }
 }

Debugger presets

The following table summarizes the available presets.

For more information about debugger preferences, see Add debuggers.

PresetDescription
AbisComma-separated list of system architecture definitions.
BinaryPath to the debugger executable. Can be an absolute path, the value auto, or an ABI. Finds the appropriate debugger for MSVC toolchains where Qt Creator does not know the binary path.
DisplayNameName of the debugger.
EngineTypeDebugger engine type:
  • 1 for GDB
  • 4 for CDB
  • 8 for PDB
  • 256 for LLDB
  • 512 for GDB DAP
  • 1024 for LLDB DAP
  • 4096 for uVision Debugger
VersionVersion number of the debugger.

An example of Qt Creator debugger presets:

 "vendor": {
   "qt.io/QtCreator/1.0": {
     "debugger": {
       "DisplayName": "GNU gdb 11.2.0 for MinGW 11.2.0 64-bit",
       "Abis": ["x86-windows-msys-pe-64bit"],
       "Binary": "C:/Qt/Tools/mingw1120_64/bin/gdb.exe",
       "EngineType": 1,
       "Version": "11.2.0"
     }
   }
 }

Qt version presets

The following table summarizes the available presets.

For more information about Qt version preferences, see Add Qt versions.

PresetDescription
qtPath to the Qt installation folder.

An example of Qt Creator Qt version presets:

 "vendor": {
   "qt.io/QtCreator/1.0": {
     "qt": "$env{HOME}/Qt/6.11.0/macos/bin/qmake"
   }
 }

See also How to: Build with CMake, Building projects with CMake, CMake, CMake presets, and SDK Tool.